const app = require('express')();
const http=require('http').createServer(app)
const io=require('socket.io')(http)

io.on('connection',function(socket){
    // socket.emit('my message','我来了，嘤嘤嘤')
    // socket.broadcast.emit('char message','嘤嘤嘤加入房间')

    socket.on('disconnect',function(){
        // socket.emit('my message','我走了，嘤嘤嘤')
        // socket.broadcast.emit('char message','嘤嘤嘤走了')
    })
    socket.on('deal message',function(value){
        console.log(value)
        // socket.emit('my message',value)
        socket.broadcast.emit('char message',value) 
        // io.emit('charge message',value)
    })
})
http.listen(9001,function(){
    console.log('comming')
})